#ifndef CH8LIST2_H
#define  CH8LIST2_H

// Class Declarations for ListOfContracts
// File: ch8list2.h

#include "contrct2.h"  // Uses the modified version of the contract class.

const
	MAX_CONTRACTS = 20;   // arbitrary number chosen for test purposes

typedef
	Contract ContractArray[MAX_CONTRACTS];


class ListOfContracts
{
public:
	ListOfContracts();
   /*
		Purpose:	to instantiate (create) an instance of the class 'ListOfContracts'.
		Goal:		a new instance of class 'ListOfContracts' now exists

		Inputs: 	NONE
		Outputs:	NONE
		Receives:	NONE
		RETURNS:	NONE
	*/

	void Add(Contract contract);
	/*
		Purpose:	To add an instance of the class 'Contract' to the list.
		Goal:		A new instance of class 'contract' is on the list

		Inputs: 	NONE
		Outputs:	Error message if list is full
		Receives:	a contract
		Returns: NONE:
	*/


	void Delete(int contractNum);
	/*
		Purpose:	To delete an instance of the class 'Contract' from the list.
		Goal:		The instance of class 'contract' is deleted

		Inputs: 	NONE
		Outputs:	Error message if contractNum is not a valid contract number
		Receives:	a contract number
		Returns: NONE:
	*/

	bool FindContract(int ID, Contract& contract);
	/*
		Purpose:	To find out if a contract is in the list
		Goal:	If the list holds a contract with id 'ID', the function 
				returns that contract in the variable 'contract' and 
				the function returns true
				Or the function returns false and 'contract' holds garbage.'


		Inputs:		NONE
		Outputs: 	NONE
		Receives:   A contract ID
		Returns:		Whether or not the contract was found AND if found, the contract
						itself.
	*/

	void ReplaceContract (Contract contract);
	/*
		Purpose:	To replace the properties of one contract in the list
		Goal:    The properties of the contract in the list with the ID of
					'contract' have been replaced

		Inputs:		NONE
		Outputs:		NONE
		Receives:	A contract
		Returns:		NONE
	*/

	void DisplayAll();
	/*
		Purpose:	To display all the contracts in the list
		Goal:	All the contracts are displayed

		Inputs:		NONE
		Outputs:		All the contracts in the list
		Receives:	NONE
		Returns:		NONE
	*/


private:
	int numContracts;  // indicates next available slot in list
	ContractArray listOfContracts;
	int Search(int contractID);

};



#endif